<template>
  <div class="app">
    <!-- 社区活动 -->
    <div class="huxing">
      <h3>社区活动</h3>
      <span>一群人的故事</span>
      <p @click="communitys()">查看更多 ></p>
      <ul class="slide-box">
        <li
          class="slide-item1"
          @click="community(item.boyu_cid)"
          v-for="(item, index) of boyu_community"
          :key="index"
        >
          <div class="img1-items">
            <img :src="item.boyu_cpicture" />
          </div>
          <div class="details">
            <span v-html="item.boyu_ctitle"></span>
            <p v-html="item.boyu_ctime"></p>
            <p v-html="item.boyu_cplace"></p>
          </div>
        </li>
      </ul>
    </div>
    <!-- 泊寓+ -->
    <div class="faxian">
      <h3>泊寓+</h3>
      <span>城市青年家</span>
      <p @click="byplus()">查看更多 ></p>
      <div class="qb_hx">
        <div
          @click="story(item.boyu_sid)"
          v-for="(item, index) of boyou_story"
          :key="index"
        >
          <img :src="item.boyu_simg" />
          <p v-html="item.boyu_stitle"></p>
        </div>
      </div>
    </div>
    <!-- 泊寓ING -->
    <div class="faxian">
      <h3>泊寓ING</h3>
      <span>快泊到我怀里来</span>
      <p @click="ing()">查看更多 ></p>
      <ul class="slide-box">
        <li
          class="slide-item"
          @click="ingstory(item.boyu_gid)"
          v-for="(item, index) of boyu_ing"
          :key="index"
        >
          <div class="img-items">
            <img :src="item.boyu_gimg" />
          </div>
          <p>{{ item.boyu_gtitle }}</p>
        </li>
      </ul>
    </div>
  </div>
</template>
<script>
export default {
  data() {
    return {
      boyou_story: [],
      boyu_ing: [],
      boyu_community: [],
    };
  },
  mounted() {
    this.axios.get("/storyplus").then((res) => {
      this.boyou_story = res.data.results;
    });
    this.axios.get("/ing").then((res) => {
      this.boyu_ing = res.data.results;
    });
    this.axios.get("/community").then((res) => {
      this.boyu_community = res.data.results;
    });
  },

  methods: {
    story(kw) {
      if (kw) {
        this.$router.push({
          path: "/storyplus",
          query: {
            sid: kw,
          },
        });
      }
    },
    community(kw) {
      if (kw) {
        this.$router.push({
          path: "/party",
          query: {
            cid: kw,
          },
        });
      }
    },
    ingstory(kw) {
      if (kw) {
        this.$router.push({
          path: "/ingstory",
          query: {
            gid: kw,
          },
        });
      }
    },
    ing(kw) {
      this.$router.push({
        path: "/ing",
      });
    },
    byplus(kw) {
      this.$router.push({
        path: "/byplus",
      });
    },
    communitys(kw) {
      this.$router.push({
        path: "/communitys",
      });
    },
  },
};
</script>
<style scoped>
.faxian {
  padding-left: 14px;
  padding-right: 14px;
}

.faxian > h3 {
  margin-bottom: 5px;
}

.faxian > span {
  color: #666;
}

.faxian > p {
  font-size: 14px;
  color: #888;
  float: right;
  margin-top: -22px;
}

.qb_hx {
  width: 100%;
  display: flex;
  justify-content: space-around;
  flex-wrap: wrap;
}

.qb_hx div {
  flex: 0 0 48%;
  margin-top: 10px;
  margin-bottom: 10px;
}

.qb_hx img {
  width: 100%;
  height: 152px;
  border-radius: 5px;
}

.qb_hx p {
  margin-top: 3px;
  margin-bottom: 3px;
  font-size: 14px;
  font-weight: 600;
}

ul,
li {
  list-style: none;
}

.slide-box {
  margin-top: 20px;
  margin-bottom: 40px;
  display: -webkit-box;
  overflow-x: auto;
  /*适应苹果*/
  -webkit-overflow-scrolling: touch;
}

.slide-item {
  width: 117px;
  /* border: 1px solid #fff; */
  margin-right: 10px;
  border-radius: 5px;
}

.slide-item > p {
  font-size: 14px;
  margin-top: 10px;
  text-align: center;
}

.img-items {
  width: 100%;
  height: 155px;
  border: 1px solid #aaa;
  border-radius: 5px;
}

.slide-box::-webkit-scrollbar {
  display: none;
}

.huxing {
  padding-left: 14px;
  padding-right: 14px;
}

.huxing > h3 {
  margin-bottom: 5px;
}

.huxing > span {
  color: #666;
}

.huxing > p {
  font-size: 14px;
  color: #888;
  float: right;
  margin-top: -22px;
}

.price > span {
  color: burlywood;
}

.biaq {
  font-size: 12px;
}

.biaq > span {
  border: 0.1em solid #888;
  border-radius: 3px;
  margin-right: 5px;
  padding: 0 5px;
  color: #888;
}

.img1-items > img {
  border-radius: 5px;
  width: 320px;
  height: 200px;
}

.slide-item1 {
  margin-right: 10px;
  border-radius: 5px;
}

.details > span {
  font-weight: 600;
}

.details > p {
  font-size: 14px;
  color: #888;
}
</style>